package com.wk.code.wkserver.controller.admin;

import com.wk.code.wkserver.controller.common.BaseController;
import com.wk.code.wkserver.entity.TechType;
import com.wk.code.wkserver.request.admin.AdminUserWithdrawRequest;
import com.wk.code.wkserver.request.admin.TechTypeRequest;
import com.wk.code.wkserver.request.admin.WithdrawVerifyRequest;
import com.wk.code.wkserver.request.app.DemandVerifyRequest;
import com.wk.code.wkserver.request.app.UserWithdrawRequest;
import com.wk.code.wkserver.response.admin.UserInfoDetailResponse;
import com.wk.code.wkserver.response.admin.UserWithdrawResponse;
import com.wk.code.wkserver.response.base.PageInfo;
import com.wk.code.wkserver.response.result.R;
import com.wk.code.wkserver.service.IUserWithdrawService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 技术类别表 前端控制器
 * </p>
 *
 * @author wq
 * @since 2021-08-15
 */
@RestController
@RequestMapping("admin/withdraw")
@AllArgsConstructor
@Api(tags = "admin-后台提现管理")
public class AdminWithdrawController extends BaseController {

    final IUserWithdrawService userWithdrawService;


    /**
     * 分页列表
     *
     * @param req 请求参数
     * @return R
     */
    @ApiOperation(value = "分页列表")
    @PostMapping("/page")
    public R<PageInfo<UserWithdrawResponse>> page(@RequestBody AdminUserWithdrawRequest req) {
        return R.success(userWithdrawService.pageList(req));
    }

    /**
     * 提现审核
     *
     * @param request 请求参数
     * @return R
     */
    @ApiOperation(value = "提现审核")
    @PostMapping("/verify")
    public R<Void> verifyDemand(@RequestBody WithdrawVerifyRequest request) {
        userWithdrawService.verify(getSysUserId(), request);
        return R.success();
    }

    /**
     * 提现详情
     *
     * @param id 提现ID
     * @return R
     */
    @ApiOperation(value = "用户详情")
    @GetMapping("/detail")
    public R<UserWithdrawResponse> detail(Integer id) {
        return R.success(userWithdrawService.detail(id));
    }


}
